UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ej40Fz3iImuOlm5DRHJgtuwU/S0MQMzwP3Hrx3E5/4w=' 
WHERE 
  key_id = 'b990b841b7b8c1c7a79bfe619cccd63a79316d412c02b22d5efdad886f2a4758' 
  AND (
    token = 'Ej40Fz3iImuOlm5DRHJgtuwU/S0MQMzwP3Hrx3E5/4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035