UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T5hbD7hsjEnEqbN3ZEHWHmMPssY2hY8EEV7dLt4RzPc=' 
WHERE 
  key_id = 'f57a6cb1e0bc0da50d01ef9f5afc11872570549cbbecc77abfab219c4c7d0ea6' 
  AND (
    token = 'T5hbD7hsjEnEqbN3ZEHWHmMPssY2hY8EEV7dLt4RzPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032