UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8CLf8FJPeC845WoSFlcEK8jtNuBLOipA8CoTQHZFTbQ=' 
WHERE 
  key_id = '8fe7ee3b0a252aa40d9c47a6c73fb690554eca7cbed7c9520b8a70f11e89b2b8' 
  AND (
    token = '8CLf8FJPeC845WoSFlcEK8jtNuBLOipA8CoTQHZFTbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037