UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IY1HrBb2wea2B6onj/MHRcZH+LBIPcz4VaCmXKPZBDE=' 
WHERE 
  key_id = '31a3e6a76c8f548740365886c26260ac84cf9b36c651082a1ef4d01349d9e4ef' 
  AND (
    token = 'IY1HrBb2wea2B6onj/MHRcZH+LBIPcz4VaCmXKPZBDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025