UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AUVhzix54Up+HkrHX05plNrKzLxe0734N6SqmeJoMNc=' 
WHERE 
  key_id = '1b7343a05569b818caad8eff862b4e4b5e57f018105db374996511d3c4c4603f' 
  AND (
    token = 'AUVhzix54Up+HkrHX05plNrKzLxe0734N6SqmeJoMNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030