UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a9ynv3gR6VN+jqC5hI3Rlpp6YjUD/+NTp+BWZjf1hRI=' 
WHERE 
  key_id = '513f8196020b4e0d48b2d23148654dcf43b30b20c86f5a57ba1711f7bc4b3626' 
  AND (
    token = 'a9ynv3gR6VN+jqC5hI3Rlpp6YjUD/+NTp+BWZjf1hRI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044