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

Query time 0.00035