UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0/VeqKo5Pu699431c8CSINjYnDe7cvD31E72vhS0V94=' 
WHERE 
  key_id = '21e2165e79f88041f4196f49a16eb232d0da25a471d6878e79e46a196c44130b' 
  AND (
    token = '0/VeqKo5Pu699431c8CSINjYnDe7cvD31E72vhS0V94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029