UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GBhNM6hjWPj0TPyEa/3gNiwW+7cKOSr6HLHtvqqRslw=' 
WHERE 
  key_id = '2bdd1972872ca7a54fbe4780c1b9cb298b46c16841edfa8e9f06f45b5b45f62f' 
  AND (
    token = 'GBhNM6hjWPj0TPyEa/3gNiwW+7cKOSr6HLHtvqqRslw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023