UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zy2h1SZdE2/O9l0UUsF3jF+WG0RtRNcOHkBpGKpdbd8=' 
WHERE 
  key_id = 'd1ed100a481b36250f4b6e2c3f79855aabceab782b8e37896d4c83368132efbf' 
  AND (
    token = 'zy2h1SZdE2/O9l0UUsF3jF+WG0RtRNcOHkBpGKpdbd8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030