UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nA4plts0kjpnb0tmxdzz7Q+CXM+vMvryX25eO+I33pQ=' 
WHERE 
  key_id = '3926429c07eed0075d993d9e82e63d95afefab89fa264fb1b9b202dc66be5171' 
  AND (
    token = 'nA4plts0kjpnb0tmxdzz7Q+CXM+vMvryX25eO+I33pQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018