UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NFKI0EsvBkH4NZE5TNkimCmzD1rDlRY+2KI3EsvyY8Q=' 
WHERE 
  key_id = 'bf8d18f4f84a1fe78c4a6ae9288e80493947c8233756cb9f5532844aca4c4663' 
  AND (
    token = 'NFKI0EsvBkH4NZE5TNkimCmzD1rDlRY+2KI3EsvyY8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028