UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9j14/8rH6Z8LDhPPFX4K4QB4BFmriazmxkibDz7k3Hc=' 
WHERE 
  key_id = '861bee3ab5558881befd1ca296c9acab5801cbda411428c617623d22ce24533f' 
  AND (
    token = '9j14/8rH6Z8LDhPPFX4K4QB4BFmriazmxkibDz7k3Hc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038