UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WN1t3Vp2JMpYptG2uNCwCwK9/4E7cVa6RpMYzJqcFhk=' 
WHERE 
  key_id = 'a77b7aee8132f7384b4852687583562f22dd77210b6aeda20578fd50d221c04f' 
  AND (
    token = 'WN1t3Vp2JMpYptG2uNCwCwK9/4E7cVa6RpMYzJqcFhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039