UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JQEb2v2eTD9lzI2m7eTRo1Blj0AS6LU9+G3vC8f6zec=' 
WHERE 
  key_id = '3fc3f37d9bf9e23c112b95a0cbe475b66faa9e5d1f7ca21dd6a6fb413c868978' 
  AND (
    token = 'JQEb2v2eTD9lzI2m7eTRo1Blj0AS6LU9+G3vC8f6zec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023