UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9h7mbFJLPoiQA2/Rdd1RKUWYMM3/oUq8iujrEbOdvW8=' 
WHERE 
  key_id = '253da4fc71fe64366824ba252efee04a6cd43c2fdff190553b685ab18b3781d4' 
  AND (
    token = '9h7mbFJLPoiQA2/Rdd1RKUWYMM3/oUq8iujrEbOdvW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033