UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ElOdBOt5bo4MeSaAq4JyZuioOCy3/dy4FV74afIsdhU=' 
WHERE 
  key_id = '3161fac8f80f28abe894b51c3c78e83af21bf0c01ffc3fd58a66ea59e38ee0bd' 
  AND (
    token = 'ElOdBOt5bo4MeSaAq4JyZuioOCy3/dy4FV74afIsdhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040