UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EG3ZnmaDOq/Myu+4lg90G3Dl7tqnrEE6015Ggh61NwU=' 
WHERE 
  key_id = '2e2d80b3d67f1d40327a6f60d6c77f724af61833c2ddacebf62369f8b148079a' 
  AND (
    token = 'EG3ZnmaDOq/Myu+4lg90G3Dl7tqnrEE6015Ggh61NwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017