UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'be9gAwbW0KORQWgu0M1aTRHK3WubyWN5Nozvut2+Fz4=' 
WHERE 
  key_id = '7b1577f34d41cd9cdb227e15a5341b8c3213adea01a4c2f019d5d8e166353ee1' 
  AND (
    token = 'be9gAwbW0KORQWgu0M1aTRHK3WubyWN5Nozvut2+Fz4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027