UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hvpCAt08WA3bPFvN87K/IN13ALJ3MN6NEwUcEj3fKKA=' 
WHERE 
  key_id = '81e3e5888e44abfb54b4225d99e8226014b1611923e816df35b7ae21944545a6' 
  AND (
    token = 'hvpCAt08WA3bPFvN87K/IN13ALJ3MN6NEwUcEj3fKKA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034