UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PHgzskLmIzdOsrZngY5xNgv3f+KmKXu/M4rQG1OFMD8=' 
WHERE 
  key_id = '824bf436cd808c4783fd6e578e7c9223123639d021725d81ce7de069cd36888c' 
  AND (
    token = 'PHgzskLmIzdOsrZngY5xNgv3f+KmKXu/M4rQG1OFMD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033