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

Query time 0.00045