UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'shvdWktAsnwne+XJBLUcwHCEZCOMv3l32Epw5Ms4pgs=' 
WHERE 
  key_id = '7dffcc552f7b45c9014118f7c8ccb806d5ebb01be7dcfd41554aad1998639216' 
  AND (
    token = 'shvdWktAsnwne+XJBLUcwHCEZCOMv3l32Epw5Ms4pgs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032