UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SBiVSib8s2s+rsj/c/HllG702YC3EcJHAvHzkfU3Z+4=' 
WHERE 
  key_id = 'd5e2e057b9029b0bde71f7e17d797e368d3ab6f049a0bae4123c52c4259c9616' 
  AND (
    token = 'SBiVSib8s2s+rsj/c/HllG702YC3EcJHAvHzkfU3Z+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066