UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tQAZoWoBXkZ0mx0vMOmW43yDgc9pLuPwEuXaEfchb/o=' 
WHERE 
  key_id = '1226e11233cb6ae86ee7f53207890c794883d62a078d099848b15813f2a41df0' 
  AND (
    token = 'tQAZoWoBXkZ0mx0vMOmW43yDgc9pLuPwEuXaEfchb/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043