UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j3AceUtNBmvKjy/oFLagihyZxE2ZpgeYYXvJroVg2NA=' 
WHERE 
  key_id = '2a0c13ee4ad6362c506ef073828aec9de82fd4869d70c88ac546abe82553257e' 
  AND (
    token = 'j3AceUtNBmvKjy/oFLagihyZxE2ZpgeYYXvJroVg2NA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057