UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sAqKhx6s00KAyKIPVHZzIrnxcDh2+SPwdFjbc12bxVw=' 
WHERE 
  key_id = '8d006a69b70cb4711cc4c8a6fa0613126e6273a10453a06c738508b80bcf94c2' 
  AND (
    token = 'sAqKhx6s00KAyKIPVHZzIrnxcDh2+SPwdFjbc12bxVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026