UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XHu3i9IIDt1X9WpnNvmj1bR8mjd9TiiRC3EGuP9GUYg=' 
WHERE 
  key_id = 'd4f5271c6d2b56f03a366e1150cbadfcf8e3e537f4f6e9a08df4cbd38fcb026c' 
  AND (
    token = 'XHu3i9IIDt1X9WpnNvmj1bR8mjd9TiiRC3EGuP9GUYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017