UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RDqu0+PqzwphZoUZ72XRnKUE1z8PkV7+GKx4Se21mIA=' 
WHERE 
  key_id = '0d47d12716223a51e7dc58eb00dea575d6b24e412a35b60e9c163b144194f651' 
  AND (
    token = 'RDqu0+PqzwphZoUZ72XRnKUE1z8PkV7+GKx4Se21mIA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041