UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l8FN2jfRRO8gytsjUgic1NKoB+jmrEZdo68lK/TuyQs=' 
WHERE 
  key_id = 'd718e1c4d980ec86564ca4a302cd1b9308e64348cff4a50208984462781ad844' 
  AND (
    token = 'l8FN2jfRRO8gytsjUgic1NKoB+jmrEZdo68lK/TuyQs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036